package com.yuan.model_convenient.repository;

import com.yuan.model_convenient.domain.ConvenientRepair;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.sql.Timestamp;
import java.time.LocalDate;
import java.util.List;

public interface ConvenientRepairDao extends JpaRepository<ConvenientRepair, Integer>, JpaSpecificationExecutor<ConvenientRepair> {
    @Query(value = "select user.nickName from User user where user.id = :liverId")
    String findUserNameById(Long liverId);

    @Query(value = "select user.phone from User user where user.id = :liverId")
    String findUserPhoneById(Long liverId);

    @Query(value = "SELECT cr FROM ConvenientRepair cr WHERE DATE(cr.createTime) = :createTime")
    List<ConvenientRepair> findConvenientRepairByTime(LocalDate createTime);

}
